How to modify the texture of a SUIButton by script using Java
When the SUIButton is not pressed
In your Java class, do the following:
public class YourClass extends Component {
// creates a new texture
public Texture texture; // select in properties
// creates a new SUIButton, @AutoWired selects the component from this object
@AutoWired
private SUIButton button;
@Override
public void start() {
}
@Override
public void repeat() {
// changes the texture of SUIButton
button.setNormalImage(texture);
}
}
When the SUIButton is pressed
In your Java class, do the following:
public class YourClass extends Component {
// creates a new texture
public Texture texture; // select in properties
// creates a new SUIButton, @AutoWired selects the component from this object
@AutoWired
private SUIButton button;
public void start() {
}
public void repeat() {
// changes the texture of SUIButton
button.setPressedImage(texture);
}
}